package com.itheima.tanhua.admin.interceptor;

import com.itheima.model.domain.Manager;

public class ManagerHolder {
    private static ThreadLocal<Manager> t1 = new ThreadLocal<>();
    //    存对象
    public static void set(Manager manager){
        t1.set(manager);
    }
    //    取对象
    public static Manager get(){
        return t1.get();
    }
    //用户id
    public static Long getUid(){
        return t1.get().getUid();
    }
    //手机号
    public static String getUsername(){
        return t1.get().getUsername();
    }
    //防止内存溢出
    public static void remove(){
        t1.remove();
    }
}